<template>
  <div class="home">
    <!-- 添加景点详情页面的入口 -->
    <div class="demo-section">
      <h2>旅游景点展示系统</h2>
      <p class="subtitle">选择适合您设备的版本</p>

      <div class="version-buttons">
        <button class="demo-btn mobile-btn" @click="goToMobile">
          <div class="btn-icon">
            <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
              <path d="M17,19H7V5H17M17,1H7C5.89,1 5,1.89 5,3V21A1,1 0 0,0 6,22H18A1,1 0 0,0 19,21V3C19,1.89 18.1,1 17,1Z"/>
            </svg>
          </div>
          <div class="btn-content">
            <span class="btn-title">移动端版本</span>
            <span class="demo-note">触摸友好界面，支持手势操作</span>
          </div>
        </button>

        <button class="demo-btn desktop-btn" @click="goToDesktop">
          <div class="btn-icon">
            <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
              <path d="M21,16H3V4H21M21,2H3C1.89,2 1,2.89 1,4V16A1,1 0 0,0 2,17H10V19H8V21H16V19H14V17H22A1,1 0 0,0 23,16V4C23,2.89 22.1,2 21,2Z"/>
            </svg>
          </div>
          <div class="btn-content">
            <span class="btn-title">PC端大屏版本</span>
            <span class="demo-note">专业展示界面，适配大屏幕</span>
          </div>
        </button>
      </div>

      <!-- 测试功能 -->
      <div class="test-section">
        <button class="test-btn" @click="resetSplash">
          重置移动端开屏动画
        </button>
        <button class="test-btn" @click="resetDesktopIntro">
          重置PC端开场特效
        </button>
      </div>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'

export default {
  name: 'HomeView',
  components: {
    HelloWorld
  },
  methods: {
    goToMobile() {
      this.$router.push('/attraction/')
    },
    goToDesktop() {
      this.$router.push('/attraction-desktop/')
    },
    resetSplash() {
      localStorage.removeItem('attraction_visited')
      alert('移动端开屏动画已重置，下次访问移动端将显示开屏动画')
    },
    resetDesktopIntro() {
      localStorage.removeItem('desktop_intro_viewed')
      alert('PC端开场特效已重置，下次访问PC端将显示开场特效')
    }
  }
}
</script>

<style lang="scss" scoped>
.demo-section {
  margin-top: 40px;
  padding: 40px 20px;
  text-align: center;

  h2 {
    color: #333;
    margin-bottom: 12px;
    font-size: 32px;
    font-weight: 800;
  }

  .subtitle {
    color: #666;
    font-size: 18px;
    margin-bottom: 40px;
  }

  .version-buttons {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .demo-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    color: #333;
    border: 2px solid #e2e8f0;
    padding: 24px 32px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-width: 280px;
    text-align: left;

    &:hover {
      transform: translateY(-4px);
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
      border-color: #3b82f6;
    }

    &:active {
      transform: translateY(-2px);
    }

    .btn-icon {
      flex-shrink: 0;
      width: 48px;
      height: 48px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .btn-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .btn-title {
      font-size: 18px;
      font-weight: 700;
      color: #1e293b;
    }

    .demo-note {
      font-size: 14px;
      color: #64748b;
      font-weight: 400;
    }

    &.mobile-btn {
      .btn-icon {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        color: white;
      }

      &:hover {
        border-color: #10b981;
      }
    }

    &.desktop-btn {
      .btn-icon {
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
        color: white;
      }

      &:hover {
        border-color: #3b82f6;
      }
    }
  }
}

// 测试功能
.test-section {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;

  .test-btn {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;

    &:hover {
      background: #f1f5f9;
      border-color: #cbd5e1;
      color: #475569;
    }
  }
}

@media (max-width: 768px) {
  .demo-section {
    margin-top: 20px;
    padding: 20px 16px;

    h2 {
      font-size: 24px;
    }

    .subtitle {
      font-size: 16px;
      margin-bottom: 30px;
    }

    .version-buttons {
      flex-direction: column;
      gap: 16px;
    }

    .demo-btn {
      min-width: auto;
      padding: 20px 24px;

      .btn-icon {
        width: 40px;
        height: 40px;
      }

      .btn-title {
        font-size: 16px;
      }

      .demo-note {
        font-size: 13px;
      }
    }
  }
}
</style>
